package com.youtellv1.config;

import lombok.Data;

import java.io.Serializable;

@Data
public class ResultData<T> implements Serializable {
    private static final String MSG = "SUCCESS";
    private static final Integer CODE = 200;
    private Integer code;
    private Boolean success;
    private String message;
    private String request;
    private Long timestamp;
    private T data;
    public ResultData(){
        this.code = CODE;
        this.message = MSG;
        this.data = null;
        this.success = Boolean.TRUE;
    }
    public ResultData(T data){
        this.code = CODE;
        this.message = MSG;
        this.data = data;
        this.success = Boolean.TRUE;
    }
    public ResultData(Integer code, String message, T data){
        this.code = code;
        this.message = message;
        this.data = data;
        this.success = code.equals(CODE);
    }

    public ResultData success(T data){
        ResultData resultData = new ResultData();
        return resultData;
    }

}
